table.insert(itemActions,
	function(item, action)
		-- WHITE glitcable armors/shields/helms (eth, nonsup, nonsoc)
		local priority = 8 -- pick priority
	
		if not (
				isGlitchableArmor(item) or
				isGlitchableShield(item) or
				isGlitchableHelm(item)
				) then 
			return false
		elseif action == aPICK then
			return priority
		end

		return false
	end
)

minGlitchableArmorDefense = 700 -- change this if you want
	--[[
		0 will keep all defenses
		700 will keep only defenses 700+
		etc.
		
		*only applies to armors
		]]

function isGlitchableArmor(item)
	return (
			(
			item.baseItem.code == "uui" or -- Dusk
			item.baseItem.code == "uea" or -- Wyrm
			item.baseItem.code == "ula" or -- Scarab
			item.baseItem.code == "urs" or -- Hauberk
			item.baseItem.code == "uhn" or -- Boneweave
			item.baseItem.code == "utp" or -- AP
			item.baseItem.code == "uld" or -- Kraken
			item.baseItem.code == "uth" or -- Lacquered
			item.baseItem.code == "uul" or -- Shadow
			item.baseItem.code == "uar"    -- Sacred
			)
			and item.quality == ItemQuality.Normal and item.flags.Ethereal and not item.flags.Socketed
			and defenseCalc(item) >= minGlitchableArmorDefense
			)
end

function isGlitchableShield(item)
	-- curently does NOT check for bonus mods (edam, res) or defense
	return (
			(
			item.baseItem.code == "pab" or -- STarge
			item.baseItem.code == "pac" or -- SRondache
			item.baseItem.code == "pad" or -- Kurast
			item.baseItem.code == "pae" or -- Zakarum
			item.baseItem.code == "paf" -- Vortex
			)
			and item.quality == ItemQuality.Normal and item.flags.Ethereal and not item.flags.Socketed
			)
end

function isGlitchableHelm(item)
	-- currently does NOT check for defense
	return (
			(
			item.baseItem.code == "uhm" or -- Spired
			item.baseItem.code == "urn" or -- Carona
			item.baseItem.code == "usk" or -- Demonhead
			item.baseItem.code == "uh9" -- Bone Visage
			)
			and item.quality == ItemQuality.Normal and item.flags.Ethereal and not item.flags.Socketed
			)
end
	